package com.design.iterator;


import java.util.List;

/**
 * @author leali
 * @title: AbstractObjectList
 * @projectName design
 * @description: 抽象聚合类
 * @date 2022/1/3 19:17
 */
public abstract class AbstractObjectList {
    protected List objects;

    public AbstractObjectList(List objects) {
        this.objects = objects;
    }

    public void addObject(Object obj) {
        this.objects.add(obj);
    }

    public void removeObject(Object obj) {
        this.objects.remove(obj);
    }

    public List getObjects() {
        return this.objects;
    }

    /**
     * 声明创建迭代器对象的抽象工厂方法
     * @return 迭代器对象
     */
    public abstract AbstractIterator createIterator();
}
